# -*- coding: utf-8 -*-
import scrapy


class RenSpider(scrapy.Spider):
    name = 'ren'
    allowed_domains = ['http://www.renren.com/']
    #start_urls = ['http://www.renren.com']

    def start_requests(self):
        url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=201810220049'
        data = {
            'email': '13706207512',
            'icode': '海和存质',
            'origURL': 'http://www.renren.com/home',
            'domain': 'renren.com',
            'key_id': '1',
            'captcha_type': 'web_login',
            'password': '7db5de13e3cb98d2caffed2449a5bd79b46825b70d9a4380b8f96745800fcf96',
            'rkey': '6155b149becd4388cbeffb7f5d76440f',
        }

        yield scrapy.FormRequest(
            url = url,
            formdata = data,
            callback = self.parse
        )

    def parse(self, response):
        print(response.text)